import { defineStore } from 'pinia'
import { reactive } from 'vue'
export const useAlbumStore = defineStore(
  'album',
  () => {
    const sortInfo = reactive({
      orderBy: 'update_time',
      order: 'desc'
    })
    const setSortInfo = type => {
      if (sortInfo.orderBy === type) {
        sortInfo.order = sortInfo.order === 'desc' ? 'asc' : 'desc'
      } else {
        sortInfo.orderBy = type
      }
    }
    return {
      sortInfo,
      setSortInfo
    }
  },
  {
    persist: true
  }
)
